package org.wu.framework.inner.lazy.orm.spring.config;

import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.wu.framework.lazy.orm.database.lambda.stream.lambda.LazyLambdaStream;
import org.wu.framework.lazy.orm.database.sql.smart.database.Perfect;
import org.wu.framework.lazy.orm.database.sql.smart.database.SmartLazyOperationAutoStuffed;
import org.wu.framework.lazy.orm.database.sql.smart.database.persistence.LazySmartLazyOperation;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Role;

@ConditionalOnProperty(prefix = "spring.datasource", value = "url")
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public class LazySmartLazyOperationAutoConfiguration {

    @Bean
    @ConditionalOnBean({SmartLazyOperationAutoStuffed.class, Perfect.class})
    public LazySmartLazyOperation lazySmartLazyOperation(
            SmartLazyOperationAutoStuffed autoStuffedLazyOperation,
            Perfect perfect,
            LazyLambdaStream lazyLambdaStream
    ) {
        return new LazySmartLazyOperation(autoStuffedLazyOperation, perfect, lazyLambdaStream);
    }
}
